from Sodev.irqKill import IRQKill
from Sodev.IRQTimeOut import IRQTimeOut
from Sodev.IO import IO
from Sodev.irqIO import IRQIO

class HandlerPCB:
    def __init__(self, kernel):
        self.rutinas = {}
        self.kernel = kernel
        '''self.rutinas[0] = 'ggg'''''
        '''self.iniciarHandlers()'''
        '''aca iniciamos los distintos tipos de handler'''
        
        
    def getPcb(self):
        return self.pcb
    
    def getRutina(self):
        return  self.rutina
    
    def agregarRutina(self, key, rutina):
        self.rutinas[key] = rutina
          
    def iniciarHandlers(self):
        self.agregarRutina(0, IRQKill(self.kernel))
        self.agregarRutina(1, IRQTimeOut(self.kernel))
        self.agregarRutina(2, IRQIO(self.kernel))
    
    def manejarInterrupcion(self, key, pcb):
        rutinaH = self.rutinas[key]
        rutinaH.run(pcb)
    
    def setKernel(self, kernel):
        self.kernel = kernel
    